package com.lovo.practice_7_8;

import com.sun.source.tree.IfTree;

import java.sql.SQLOutput;
import java.util.Arrays;
import java.util.zip.CheckedOutputStream;

public class FingerGuessingGame {
    private int count=0;

    public void setCount(int count) {
        this.count = count;
    }

    public int getCount() {
        return count;
    }

    public void Game() {
        for (int i = 0; i < 10; i++) {
            Computer computer = new Computer();
            Palyer palyer = new Palyer();
            System.out.println( "机器出拳为"+computer.getFinger());;
//            System.out.println("比较数组为"+Arrays.toString(computer.getRoleArr()));


            String playFingerResult = palyer.getFinger();

            int finalNum = palyer.getRoleIndex(playFingerResult);

            if (finalNum == 0) {

              setCount(getCount()+0);
                System.out.println("输");

            } else if (finalNum == 1) {
                setCount(getCount()+1);

            } else {
                setCount(getCount()+2);
                System.out.println("赢");
            }
        }
        if (getCount() > 10) {
            System.out.println("总积分为" + getCount() + "猜拳比赛胜利");
        } else {
            System.out.println("总积分为" + getCount() + "猜拳比赛失败");
        }
    }

    public static void main(String[] args) {
        FingerGuessingGame fingerGuessingGame = new FingerGuessingGame();
        fingerGuessingGame.Game();
    }

}

